// Author: Bjorn Schobben

#ifndef POLY_H
#define POLY_H

#include "Vector.h"
#include "Pixel.h"
#include "Rect.h"
#include <vector>

class Poly
{
public:
	Poly();
	Poly(const Poly& rhs);
	virtual ~Poly();

	unsigned int GetSize() const;
	const Vector& GetPoint(unsigned int index) const;
	void AddPoint(const Vector& point);
	void SetColor(const Pixel& ncolor);
	const Pixel& GetColor() const;
	Poly& operator=(const Poly& rhs);
	void Clip(const Rect& clipRect);
	void AddOffset(const Vector& offset);
	

private:
	enum RectEdge
	{
		BOTTOMEDGE,
		TOPEDGE,
		LEFTEDGE,
		RIGHTEDGE,
		EDGECOUNT
	};

	bool InsideClipRect(const Vector& point, int edge, int value);
	Vector GetClipIntersect(const Vector& first, const Vector& second, int edge, int ivalue);

	std::vector<Vector> points;
	Pixel color;
};

#endif //POLY_H

